package com.netposa.datawarehouse.aggregator.util;

import java.io.File;

public class ProjectPath {
   public static final String classPath = Thread.currentThread().getContextClassLoader().getResource("").getPath();

   public static String getRootPath() {
      return rootPath("");
   }

   public static String getRootPath(String u_path) {
      return rootPath("/" + u_path);
   }

   private static String rootPath(String u_path) {
      String rootPath = "";
      if ("\\".equals(File.separator)) {
         rootPath = classPath + u_path;
         rootPath = rootPath.replaceAll("/", "\\\\");
         if (rootPath.substring(0, 1).equals("\\")) {
            rootPath = rootPath.substring(1);
         }
      }

      if ("/".equals(File.separator)) {
         rootPath = classPath + u_path;
         rootPath = rootPath.replaceAll("\\\\", "/");
      }

      return rootPath;
   }
}
